import {
  DURATION,
  PLAY,
  CURRENT_TIME,
  PLAYER,
  SEEK_DONE,
  PLAYLIST,
  CURRENT_MUSIC,
  DEL_TO_PLAYLIST,
  ADD_TO_PLAYLIST, TO_ADD, TO_ADD_VALUE,
} from "../../redux/action";
import BottomPlayBar from './BottomPlayBar';
import {connect} from 'react-redux';
const mapStateToProps = (state, ownProps) => {
  return {
    play:state.play,
    currentMusic:state.currentMusic,
    currentTime:state.currentTime,
    musicList:state.musicList,
    duration:state.duration,
    isPressed:state.isPressed,
    player:state.player,
    seekPlayer:state.seekPlayer,
    seeked:state.seeked,
    playControlBottom:state.playControlBottom,
    toAdd:state.toAdd,
    toAddValue:state.toAddValue
  };
};
const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    setDuration: (v) => {
      dispatch(DURATION(v));
    },
    setPlay: (v) => {
      dispatch(PLAY(v));
    },
    setCurrentTime: (v) => {
      dispatch(CURRENT_TIME(v));
    },
    setPlayer: (v) => {
      dispatch(PLAYER(v));
    },
    seeked: (v) => {
      dispatch(SEEK_DONE(v));
    },
    setMusicList :(v) => {
      dispatch(PLAYLIST(v));
    },
    setCurrentMusic :(v) => {
      dispatch(CURRENT_MUSIC(v));
    },
    delMusicList :(v) => {
      dispatch(DEL_TO_PLAYLIST(v));
    },
    addPlayList: (v) => {
      dispatch(ADD_TO_PLAYLIST(v));
    },
    setToAdd: (v) => {
      dispatch(TO_ADD(v));
    },
    setToAddValue: (v) => {
      dispatch(TO_ADD_VALUE(v));
    },
  };
};
const LinkPlay = connect(mapStateToProps, mapDispatchToProps,null,{forwardRef:true})(BottomPlayBar);

export default LinkPlay;
